﻿package temp 
{
	
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	
	/**
	 * ...
	 * @author fly
	 */
	public class ContainerClear 
	{
		
		/**
		 * 移除所有子对象
		 * @param	diplayobj
		 */
		public static function removeAllChild(diplayobj:DisplayObjectContainer,loop:Boolean = false ):void
		{
			while (diplayobj.numChildren)
			{
				if (loop == true)
				{
					var child:DisplayObject;
					child = diplayobj.getChildAt(0);
						
					if (child is DisplayObjectContainer)
					{
						removeAllChild(child as DisplayObjectContainer);
					}
				}
				diplayobj.removeChildAt(0);
				
			}
		}
	}
	
}